//
//  ZRRefreshAutoFooter.m
//  TestFile
//
//  Created by 黄涛 on 2018/7/9.
//  Copyright © 2018年 アポロジャパン. All rights reserved.
//

#import "ZRRefreshAutoFooter.h"
#import "ZRLoadingView.h"
@interface ZRRefreshAutoFooter ()

@property (nonatomic , weak) ZRLoadingView * loadingView;

@end
@implementation ZRRefreshAutoFooter

#pragma mark - 初始化
- (void)prepare{
    [super prepare];
    
    [self setTitle:@"小伙子,你不拉一下 怎么知道没惊喜？" forState:MJRefreshStateIdle];
    [self setTitle:@"放手吧,强扭的瓜不甜" forState:MJRefreshStatePulling];
    [self setTitle:@"拼命加载中" forState:MJRefreshStateRefreshing];
    [self setTitle:@"我是有底线的" forState:MJRefreshStateNoMoreData];
    
}

#pragma mark - ----------------------- 生命周期 -----------------------
#pragma mark - ----------------------- 其他方法 -----------------------
#pragma mark - ----------------------- 代理方法 -----------------------
#pragma mark - ----------------------- 活动监听 -----------------------
#pragma mark - ---------------------- set & get ----------------------

- (ZRLoadingView *)loadingView{
    if (!_loadingView) {
        ZRLoadingView * view = [[ZRLoadingView alloc] init];
        [self addSubview:view];
        _loadingView = view;
    }
    return _loadingView;
}

#pragma mark - 状态改变
- (void)setState:(MJRefreshState)state{
    [super setState:state];
    
    [self.loadingView stopAnimation];
    
    if (state == MJRefreshStateRefreshing) {
        [_scrollView.mj_header endRefreshing];
        [self.loadingView startAnimation];
    }
    
    
}



@end
